import 'package:flutter/material.dart';
import 'package:xws/utils/app_util.dart';
import 'package:xws/utils/theme_util.dart';
import 'package:xws/widgets/app_btn.dart';

///选择视频方式弹窗
class PickVideo extends StatelessWidget {
  const PickVideo({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Row(
      mainAxisAlignment: MainAxisAlignment.spaceAround,
      children: <Widget>[
        _buildWayItem(context, '选择文件', false, Icons.folder),
        _buildWayItem(context, '相机拍摄', true, Icons.camera_alt),
      ],
    );
  }

  /// 选图方式项
  Widget _buildWayItem(BuildContext context, String text, bool value, IconData icon) {
    return AppBtn.center(
      child: Column(
        children: <Widget>[
          Icon(
            icon,
            size: 60,
            color: theme(context).lighten(),
          ),
          Text(
            text,
            style: const TextStyle(fontSize: 13),
          ),
        ],
      ),
      onTap: () => close(context, value: value),
      radius: 10,
      color: Colors.transparent,
    );
  }
}
